class CreateAdvices < ActiveRecord::Migration
  def self.up
    create_table :advices do |t|
      t.string :title, :limit => 100, :null => false
      t.text :description, :null => false
      t.references :course, :null => false

      t.timestamps
    end
    add_index(:advices, [:title, :course_id], :unique => true, :name => "uk_advice_course")
  end

  def self.down
    drop_table :advices
  end
end
